#include <iostream>
using namespace std;
class Solution {
    public:
        bool isPalindrome(int x) {

            if (x < 0) {
                return false;
            }
            if (x < 10) {
                return true;
            }


            int y = x;
            int r = 0;
            while(true) {
                r = r * 10 + (y%10);
                y = y / 10;
                if (y == 0) break;
            }
            return x == r;
        }

};

int main() {

    Solution s;
    cout << s.isPalindrome(121) << endl;
}
